package testjeu;

import org.newdawn.slick.Animation;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.SpriteSheet;
import java.util.Random;


public class Mine extends Ennemis implements Constantes {

    private Animation  bip;
    
    static SpriteSheet spriteMine;
    static boolean init=false;
    static Image all;
    
    public Mine(int col, int lig) throws SlickException {
        super(col, lig);
        
        if (!init) {
            all = new Image("res/sprite_mine.png");
            spriteMine=new SpriteSheet(all, 40, 40);
            init=true;
        }
        
        // Temps aléatoire pr le clignotement
        Random Rand=new Random();
        int temps = Rand.nextInt(400);
        
        // Animations
        destruction = new Animation(spriteMine, 0, 1, 4, 1, true, 200, true);
        bip = new Animation();
        bip.addFrame(spriteMine.getSprite(0, 0), 900+temps);
        bip.addFrame(spriteMine.getSprite(1, 0), 100);
        
        
    }
    
    public void dessiner(Graphics g) {
        if (enVie) 
            bip.draw(cases.colToPxl(x), cases.ligToPxl(y));
        else {
            destruction.draw(cases.colToPxl(x), cases.ligToPxl(y));
            destruction.stopAt(4);
        }

        
    }
    
    
    
    
}
